package mvc.struts.annotation.web;

import mvc.struts.annotation.action.Controller;
import mvc.struts.annotation.action.RequestMapping;
import mvc.struts.annotation.entity.Data;
import mvc.struts.annotation.entity.Param;
import mvc.struts.annotation.entity.User;
import mvc.struts.annotation.entity.View;

@Controller
public class RegisterController {

	/**
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/myservlet/register", method="GET")
	public String onRegister(Param param)
	{
		return	"onRegister";
	}
	
	/**
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/myservlet/viewMgmt", method="GET")
	public View onViewMgmt(Param param)
	{
		View	view = new View("viewMgmt");
		
		view.addModel("viewName", "This returns View");
		
		return	view;
	}
	
	/**
	 * 
	 * @param request
	 * @param response
	 * @return
	 */
	@RequestMapping(value = "/myservlet/dataMgmt", method="GET")
	public Data onDataMgmt(Param param)
	{
		User	user = new User();
		
		user.setUser_id(1);
		user.setUser_name("Mark");
		user.setUser_sex(1);
		user.setUser_pwd("123456");
		
		Data	data = new Data(user);
		
		return	data;
	}
}
